package com.zhangfb95.crosschain.sdk.infra.data.api.server;

import com.zhangfb95.crosschain.infra.model.Result;
import com.zhangfb95.crosschain.protocol.rpc.RequestHeaderConstants;
import com.zhangfb95.crosschain.sdk.infra.model.api.request.server.rpcchainaccount.RpcChainAccountAddApiReq;
import com.zhangfb95.crosschain.sdk.infra.model.api.request.server.rpcchainaccount.RpcChainAccountAddPropertiesApiReq;
import com.zhangfb95.crosschain.sdk.infra.model.api.request.server.rpcchainaccount.RpcChainAccountListApiReq;
import com.zhangfb95.crosschain.sdk.infra.model.api.request.server.rpcchainaccount.RpcChainAccountRemoveApiReq;
import com.zhangfb95.crosschain.sdk.infra.model.api.request.server.rpcchainaccount.RpcChainAccountRemovePropertiesApiReq;
import com.zhangfb95.crosschain.sdk.infra.model.api.response.server.rpcchainaccount.RpcChainAccountListApiRes;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;

/**
 * @author zhangfubing
 * @since 2023/12/22
 */
@HttpExchange("/rpc/chain-account")
public interface RpcChainAccountApi {

    @PostExchange("/add")
    Result<Void> add(
            @RequestHeader(RequestHeaderConstants.USER_ID) String userId,
            @RequestHeader(RequestHeaderConstants.NONCE) String nonce,
            @RequestHeader(RequestHeaderConstants.TIMESTAMP) String timestamp,
            @RequestHeader(RequestHeaderConstants.AUTHORIZATION) String authorization,
            @RequestBody RpcChainAccountAddApiReq req);

    @PostExchange("/remove")
    Result<Void> remove(
            @RequestHeader(RequestHeaderConstants.USER_ID) String userId,
            @RequestHeader(RequestHeaderConstants.NONCE) String nonce,
            @RequestHeader(RequestHeaderConstants.TIMESTAMP) String timestamp,
            @RequestHeader(RequestHeaderConstants.AUTHORIZATION) String authorization,
            @RequestBody @Validated RpcChainAccountRemoveApiReq req);

    @PostExchange("/list")
    Result<RpcChainAccountListApiRes> list(
            @RequestHeader(RequestHeaderConstants.USER_ID) String userId,
            @RequestHeader(RequestHeaderConstants.NONCE) String nonce,
            @RequestHeader(RequestHeaderConstants.TIMESTAMP) String timestamp,
            @RequestHeader(RequestHeaderConstants.AUTHORIZATION) String authorization,
            @RequestBody @Validated RpcChainAccountListApiReq req);

    @PostExchange("/addProperties")
    Result<Void> addProperties(
            @RequestHeader(RequestHeaderConstants.USER_ID) String userId,
            @RequestHeader(RequestHeaderConstants.NONCE) String nonce,
            @RequestHeader(RequestHeaderConstants.TIMESTAMP) String timestamp,
            @RequestHeader(RequestHeaderConstants.AUTHORIZATION) String authorization,
            @RequestBody @Validated RpcChainAccountAddPropertiesApiReq req);

    @PostExchange("/removeProperties")
    Result<Void> removeProperties(
            @RequestHeader(RequestHeaderConstants.USER_ID) String userId,
            @RequestHeader(RequestHeaderConstants.NONCE) String nonce,
            @RequestHeader(RequestHeaderConstants.TIMESTAMP) String timestamp,
            @RequestHeader(RequestHeaderConstants.AUTHORIZATION) String authorization,
            @RequestBody @Validated RpcChainAccountRemovePropertiesApiReq req);
}
